﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tank
{
    abstract class ClassObject
    {
        public int X {get; set;}
        public int Y { get; set; }
        public int Width { get; set; }
        public int Height { get; set; }
        protected abstract Image GetImage();
        public void  DrawSelf()
        {
            Graphics g = GameFrameWorl.g;
            // 设置图片，第一个参数是图片，后面是位置， new Point 等同于 x,y
            g.DrawImage(GetImage(), X, Y);
        }
        // 当更新的时候进行绘制
        public virtual void Update()
        {
            DrawSelf();
        }
        // 检测碰撞体积
        public Rectangle GetRectangle()
        {
            // 设置碰撞体积实例，传入，坐标点，x,y,本身的长和宽
            Rectangle rectangle = new Rectangle(X, Y, Width, Height);
            return rectangle;
        }
    } 

}
